/*----------------------------------------------------------------------------*/
/* Copyright (c) FIRST 2008. All Rights Reserved.                             */
/* Open Source Software - may be modified and shared by FRC teams. The code   */
/* must be accompanied by the FIRST BSD license file in the root directory of */
/* the project.                                                               */
/*----------------------------------------------------------------------------*/

package com.techhighteam675.robot2012;
import edu.wpi.first.wpilibj.DriverStation;
import edu.wpi.first.wpilibj.SimpleRobot;

public class Robot2012 extends SimpleRobot {
    DriveType robotDriveType;
    RobotDrive robotDrivetrain;
    RobotPayload robotPayload;
    AutonomousHandler robotAutonomous;

    public Robot2012() {
        robotDriveType = new TankDrive(false);
        robotDrivetrain = new RobotDrive(robotDriveType);
        robotPayload = new RobotPayload(RobotPayload.CONTROL_DOUBLE_JOYSTICK, RobotPayload.TRACKING_MANUAL, RobotPayload.SHOOTING_MANUAL);
        System.out.println("ROBOT 2012");
    }

    /**
     * This function is called once each time the robot enters autonomous mode.
     */
    public void autonomous() {
        while(DriverStation.getInstance().isAutonomous())
        {
            robotAutonomous.update();
            try {
                wait(5);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
    }

    /**
     * This function is called once each time the robot enters operator control.
     */
    public void operatorControl() {
        while(DriverStation.getInstance().isOperatorControl())
        {
            robotDrivetrain.update();
            robotPayload.update();
            try {
                Thread.sleep(50);
            } catch (InterruptedException ex) {
                ex.printStackTrace();
            }
        }
    }
}
